import HttpUtil from '@/common/HttpUtil'

const roleApi = {
  findRolePage (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/sys/role/findRolePage'
    return HttpUtil.postJSON(postUrl, params)
  },
  addRole (params) {
    let postUrl = process.env.SURVEY_DOMAIN + '/sys/role/addRole'
    return HttpUtil.postJSON(postUrl, params)
  },
  getRoleInfo (id) {
    let postUrl = process.env.SURVEY_DOMAIN + '/sys/role/getRoleInfo/' + id
    return HttpUtil.get(postUrl, '')
  },
  updateRole (params) {
    let putUrl = process.env.SURVEY_DOMAIN + '/sys/role/updateRole'
    return HttpUtil.putJSON(putUrl, params)
  },
  deleteRole (id) {
    let getUrl = process.env.SURVEY_DOMAIN + '/sys/role/deleteRole/' + id
    return HttpUtil.delete(getUrl, null)
  },
  findUserList () {
    let getUrl = process.env.SURVEY_DOMAIN + '/sys/user/getList'
    return HttpUtil.get(getUrl, null)
  },
  findUserMenu (param) {
    let getUrl = process.env.SURVEY_DOMAIN + '/sys/role/findUserMenu/' + param
    return HttpUtil.get(getUrl, null)
  },
  findMenuChildren (param) {
    let postUrl = process.env.SURVEY_DOMAIN + '/sys/menu/findMenuChildren?path=' + param
    return HttpUtil.post(postUrl, null)
  }
}
export default roleApi
